Skip to content

fix: quote /select path in launch(locate=True) on Windows for paths with spaces#3346

Closed
terminalchai wants to merge 1 commit into
pallets:mainfrom
terminalchai:fix/launch-locate-spaces-windows
Closed

fix: quote /select path in launch(locate=True) on Windows for paths with spaces#3346
terminalchai wants to merge 1 commit into
pallets:mainfrom
terminalchai:fix/launch-locate-spaces-windows

Conversation

@terminalchai
Copy link
Copy Markdown

Fixes #2994

Problem

click.launch(path, locate=True) on Windows calls explorer /select,{path} without quoting the path. When path contains spaces, Explorer splits at the space and opens the wrong folder.

Fix

Wrap the /select, argument in double quotes and escape any embedded " as "", following Explorer's documented command-line quoting rules (as suggested by @davidism in the issue).

Tests

Added two Windows-only tests in tests/test_termui.py:

  • Verifies the /select, argument wraps the path in double quotes when the path contains spaces
  • Verifies embedded double-quotes in the path are escaped as ""

@davidism davidism closed this Apr 16, 2026
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

launch() cannot locate files with spaces in the name on Windows

2 participants